//using Firebase.RemoteConfig;
using PlayInfinity.AliceMatch3.Core;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;

public class PlayGameData : Singleton<PlayGameData>
{
	public DemoConfig gameConfig;

	public Dictionary<int, int> WeightDic = new Dictionary<int, int>
	{
		{
			1,
			1
		},
		{
			2,
			1
		},
		{
			3,
			1
		},
		{
			4,
			1
		},
		{
			5,
			1
		},
		{
			6,
			1
		},
		{
			7,
			1
		},
		{
			22,
			-151
		},
		{
			23,
			1
		},
		{
			41,
			24
		},
		{
			42,
			25
		},
		{
			43,
			26
		},
		{
			13,
			0
		},
		{
			14,
			0
		},
		{
			10,
			0
		},
		{
			11,
			0
		},
		{
			12,
			0
		},
		{
			21,
			18
		},
		{
			31,
			7
		},
		{
			32,
			8
		},
		{
			33,
			9
		},
		{
			34,
			10
		},
		{
			35,
			11
		},
		{
			71,
			12
		},
		{
			72,
			13
		},
		{
			73,
			14
		},
		{
			74,
			15
		},
		{
			51,
			22
		},
		{
			52,
			21
		},
		{
			61,
			19
		},
		{
			62,
			20
		},
		{
			10000,
			13
		},
		{
			11000,
			14
		},
		{
			12000,
			15
		},
		{
			13000,
			16
		},
		{
			20000,
			13
		},
		{
			21000,
			14
		},
		{
			22000,
			15
		},
		{
			23000,
			16
		},
		{
			24000,
			17
		}
	};

	public Dictionary<int, List<Combo>> ComboReward = new Dictionary<int, List<Combo>>
	{
		{
			0,
			new List<Combo>()
		},
		{
			1,
			new List<Combo>
			{
				new Combo(ElementType.AreaBomb, 1)
			}
		},
		{
			2,
			new List<Combo>
			{
				new Combo(ElementType.AreaBomb, 1),
				new Combo(ElementType.HorizontalBomb, 1)
			}
		},
		{
			3,
			new List<Combo>
			{
				new Combo(ElementType.AreaBomb, 1),
				new Combo(ElementType.HorizontalBomb, 1),
				new Combo(ElementType.FlyBomb, 1)
			}
		},
		{
			4,
			new List<Combo>
			{
				new Combo(ElementType.AreaBomb, 1),
				new Combo(ElementType.HorizontalBomb, 1),
				new Combo(ElementType.FlyBomb, 1),
				new Combo(ElementType.ColorBomb, 1)
			}
		}
	};

	public PlayGameData()
	{
		Init();
	}

	public void Init()
	{
		gameConfig = Resources.Load<DemoConfig>("Config/GameConfig/DemoConfig");
		//TODO 注释
		// try
		// {
		// 	FirebaseRemoteConfig.SetDefaults(new Dictionary<string, object>
		// 	{
		// 		{
		// 			"LevelWinVideoLimit",
		// 			gameConfig.MaxTimeToWinWatchVideo
		// 		},
		// 		{
		// 			"SaleActiveLevel",
		// 			gameConfig.SaleActiveLevel
		// 		},
		// 		{
		// 			"SaleTime",
		// 			gameConfig.SaleTime
		// 		},
		// 		{
		// 			"SaleCDTime",
		// 			gameConfig.SaleCDTime
		// 		},
		// 		{
		// 			"ActvieWatchVideoInGameWinLevel",
		// 			gameConfig.ActvieWatchVideoInGameWin
		// 		},
		// 		{
		// 			"ActvieWatchVideoInTaskLevel",
		// 			gameConfig.ActvieWatchVideoInTask
		// 		},
		// 		{
		// 			"TaskVideoLimit",
		// 			gameConfig.TaskVideoLimit
		// 		},
		// 		{
		// 			"FirstSaleType",
		// 			gameConfig.FirstSaleType
		// 		}
		// 	});
		// 	Task task = FirebaseRemoteConfig.FetchAsync();
		// 	UpdateManager.Instance.AddNormalUpdateToManager(new ActionUpdate(delegate
		// 	{
		// 		if (task.IsCompleted)
		// 		{
		// 			bool flag = FirebaseRemoteConfig.ActivateFetched();
		// 			ConfigValue value = FirebaseRemoteConfig.GetValue("LevelWinVideoLimit");
		// 			DebugUtils.Log(DebugType.Other, flag.ToString() + "   LevelWinVideoLimit  " + value.LongValue + "      $$");
		// 			gameConfig.MaxTimeToWinWatchVideo = (int)value.LongValue;
		// 			ConfigValue value2 = FirebaseRemoteConfig.GetValue("SaleActiveLevel");
		// 			DebugUtils.Log(DebugType.Other, flag.ToString() + "   SaleActiveLevel  " + value2.LongValue + "      $$");
		// 			gameConfig.SaleActiveLevel = (int)value2.LongValue;
		// 			ConfigValue value3 = FirebaseRemoteConfig.GetValue("SaleTime");
		// 			DebugUtils.Log(DebugType.Other, flag.ToString() + "   SaleTime  " + value3.LongValue + "      $$");
		// 			gameConfig.SaleTime = value3.LongValue;
		// 			ConfigValue value4 = FirebaseRemoteConfig.GetValue("SaleCDTime");
		// 			DebugUtils.Log(DebugType.Other, flag.ToString() + "   SaleCDTime  " + value4.LongValue + "      $$");
		// 			gameConfig.SaleCDTime = value4.LongValue;
		// 			ConfigValue value5 = FirebaseRemoteConfig.GetValue("ActvieWatchVideoInGameWinLevel");
		// 			DebugUtils.Log(DebugType.Other, flag.ToString() + "   ActvieWatchVideoInGameWinLevel  " + value5.LongValue + "      $$");
		// 			gameConfig.ActvieWatchVideoInGameWin = (int)value5.LongValue;
		// 			ConfigValue value6 = FirebaseRemoteConfig.GetValue("ActvieWatchVideoInTaskLevel");
		// 			DebugUtils.Log(DebugType.Other, flag.ToString() + "   ActvieWatchVideoInTaskLevel  " + value6.LongValue + "      $$");
		// 			gameConfig.ActvieWatchVideoInTask = (int)value6.LongValue;
		// 			ConfigValue value7 = FirebaseRemoteConfig.GetValue("TaskVideoLimit");
		// 			DebugUtils.Log(DebugType.Other, flag.ToString() + "   TaskVideoLimit  " + value7.LongValue + "      $$");
		// 			gameConfig.TaskVideoLimit = (int)value7.LongValue;
		// 			ConfigValue value8 = FirebaseRemoteConfig.GetValue("FirstSaleType");
		// 			DebugUtils.Log(DebugType.Other, flag.ToString() + "   FirstSaleType  " + value8.LongValue + "      $$");
		// 			gameConfig.FirstSaleType = (int)value8.LongValue;
		// 			return true;
		// 		}
		// 		return false;
		// 	}));
		// }
		// catch (Exception)
		// {
		// 	DebugUtils.Log(DebugType.Other, "fireBass Exception!");
		// }
	}
}
